import java.util.Comparator;
import java.util.PriorityQueue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: mac
 * Date: 2022-10-26
 * Time: 20:29
 */
class OutterClass2 {
    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;

    //静态内部类
    //1.如何实例化静态内部类对象
    //2.如何访问外部类的普通成员变量
    static class InnerClass {
        public int data4 = 4;
        public int data5 = 5;
        public static int data6 = 6;

        //public OutterClass out = new OutterClass();
        public OutterClass2 out;
        public InnerClass(OutterClass2 out){
            this.out = out;
        }
        public InnerClass(){

        }
        public void test(){
            System.out.println(out.data1);
            System.out.println(out.data2);
            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
            System.out.println("InnerClass::test()");
        }
    }
}
class Test{
    public void test() {
        System.out.println("test()haha!");
    }
}
public class TestDemo2 {
    public static void main(String[] args) {
        //匿名内部类
        new Test(){
            @Override
            public void test() {
                System.out.println("重写的test方法");
            }
        }.test();
        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return 0;
            }
        });

    }
    public static void main1(String[] args) {
        OutterClass2 o = new OutterClass2();
        OutterClass2.InnerClass innerClass = new OutterClass2.InnerClass(o);
        innerClass.test();
    }

}
